<?php

class Application_Model_DbTable_Comment extends Zend_Db_Table_Abstract
{

    protected $_name = 'comments';
    
    protected $_referenceMap = array(
        "Product" => array(
            'columns' => "product",
            'refTableClass' => "Application_Model_DbTable_Product",
            'refColumns'=>"id",
            'onDelete'=>self::CASCADE,
            'onUpdate'=>self::RESTRICT
        )
    );
    
    public function insertComment($idprod, $fullname, $email, $title, $content, $rating=0)
    {
        $row = $this->createRow(array(
            "product" => $idprod,
            "rating" => $rating,
            "fullname" =>$fullname,
            "email" => $email,
            "title" => $title,
            "content" => $content,
            "status" => 0
        ));        
        return $row->save();
    }
}

